﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Text;

namespace BlueCMS.Core.IoC.Configuration
{
    public class ComponentConfiguration : ConfigurationSection
    {
        [ConfigurationProperty("contract", IsRequired = true, IsKey = true)]
        public string Contract
        {
            get { return (string)base["contract"]; }
            set { base["contract"] = value; }
        }

        [ConfigurationProperty("scope", DefaultValue = ComponentScope.PerRequest)]
        public ComponentScope Scope
        {
            get { return (ComponentScope)base["scope"]; }
            set { base["scope"] = value; }
        }

        [ConfigurationProperty("default", DefaultValue = "default")]
        public string Default
        {
            get { return (string)base["default"]; }
            set { base["default"] = value; }
        }

        [ConfigurationProperty("", IsDefaultCollection = true, IsRequired = true)]
        [ConfigurationCollection(typeof(InstanceConfigurationCollection), AddItemName = "instance")]
        public InstanceConfigurationCollection Instances
        {
            get { return ((InstanceConfigurationCollection)base[""]); }
        }
    }
}
